package syntelos.sx.methods;

import alto.io.Output;
import alto.sys.Reference;

/**
 * Tools for methods that respond with the DAV (RFC 2518) status code
 * value 207.
 * 
 * @see Propfind
 */
public abstract class Multistatus
    extends syntelos.sx.Response
{

    public final static void List(Reference[] list, Output out)
        throws java.io.IOException
    {

        out.println("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
        out.println("<D:multistatus xmlns:D=\"DAV:\">");
        out.println(" <D:response>");
        if (null != list){
            for (int cc = 0, count = list.length; cc < count; cc++){
                Reference href = list[cc];
                out.print("  <D:href>");
                out.print(href.toString());
                out.println("</D:href>");
            }
        }
        out.println("  <D:status>HTTP/1.1 200 Ok</D:status>");
        out.println(" </D:response>");
        out.println("</D:multistatus>");
    }


    protected Multistatus(){
        super();
    }


}
